/* Header file for function.c 

   By:   S.C. Molitor (smolitor@med.unc.edu)
   Date: February 29, 2000 */


// EXPONENTIAL - a sum of N exponential functions:
//
//    F(X) = A0 + A1*exp(-t/T1) + A2*exp(-t/T2) + ... + AN*exp(-t/TN)
//
// The parameter vector P must have 2N + 1 parameters for N exponentials:
//
//                 P = [A0 A1 T1 A2 T2 ... AN TN]

double exponential(double	x,		// x value, returns f(p, x)
				   double	p[],	// parameter values in p
				   double	dfdp[],	// partial derivatives df/dp
				   int		npar);	// number of parameters in p


// EXPPOWER - an exponential function raised to the Nth power:
//
//           F(X) = Imax*[1 + (A0 - 1)*exp(-t/T)]^N
//
// where 0 <= A0 <= 1.  The parameter vector P must have 4
// parameters:
//                     P = [Imax A0 T N]

double exppower(double	x,		// x value, returns f(p, x)
			    double	p[],	// parameter values in p
			    double	dfdp[],	// partial derivatives df/dp
			    int		npar);	// number of parameters in p


// GAUSSIAN - a sum of N scaled Gaussian PDF functions:
//
//        F(X) = A0 + A1*G1(X) + A2*G2(X) + ... + AN*GN(X)
//
// where each Gaussian Gi(X) has a mean Mi and a standard deviation Si:
//
//     Gi(X) = exp(-(X - Mi)^2 / (2*Si^2)) / (SQRT(2*PI) * Si)
//
// The parameter vector P must have 3N + 1 parameters for N Gaussians:
//
//            P = [A0 A1 M1 S1 A2 M2 S2 ... AN MN SN]

double gaussian(double	x,		// x value, returns f(p, x)
				double	p[],	// parameter values in p
				double	dfdp[],	// partial derivatives df/dp
				int		npar);	// number of parameters in p


// BOLTZMANN - multistate Boltzmann function:
//
//   F(X) = A0 + (A1 - A0)/(1 + EN + EN*EN-1 + EN*EN-1*EN-2 + ...)
//
// where each Boltzmann Ei(X) has a slope Ki and a half-activation Xi:
//
//                   Ei(X) = exp(-Ki*(X - Xi))
//
// The parameter vector P must have 2N + 2 elements for N states:
//
//               P = [A0 A1 K1 X1 K2 X2 ... KN XN]

double boltzmann(double	x,		// x value, returns f(p, x)
				 double	p[],	// parameter values in p
				 double	dfdp[],	// partial derivatives df/dp
				 int	npar);	// number of parameters in p


// BOLTZSUM - sum of N individual Boltzmann functions:
//
//     F(X) = A0 + A1/(1 + E1) + A2/(1 + E2) + ... + AN/(1 + EN)
//
// where each Boltzmann Ei(X) has a slope Ki and a half-activation Xi:
//
//                   Ei(X) = exp(-Ki*(X - Xi))
//
// The parameter vector P must have 3N + 1 elements for N individual
// Boltzmanns:
//
//            P = [A0 A1 K1 X1 A2 K2 X2 ... AN KN XN]

double boltzsum(double	x,		// x value, returns f(p, x)
			    double	p[],	// parameter values in p
			    double	dfdp[],	// partial derivatives df/dp
			    int		npar);	// number of parameters in p


// IVBOLTZSUM - current form for sum of N Boltzmann functions:
//
// F(X) = A0 + (X - Vr)*[A1/(1 + E1) + A2/(1 + E2) + ... + AN/(1 + EN)]
// 
// where each Boltzmann Ei(X) has a slope Ki and a half-activation Xi:
//
//                   Ei(X) = exp(-Ki*(X - Xi))
//
// The parameter vector P must have 3N + 2 elements for N individual
// Boltzmanns:
//
//           P = [A0 Vr A1 K1 X1 A2 K2 X2 ... AN KN XN]
//

double ivboltzsum(double	x,		// x value, returns f(p, x)
			      double	p[],	// parameter values in p
			      double	dfdp[],	// partial derivatives df/dp
			      int		npar);	// number of parameters in p


